<template>
  <div>
      <div id="myChart" :style="{width: '300px', height: '300px'}"></div>
      <router-link to="/login">跳</router-link>
      <input type="text" v-model="msg">
  </div>
</template>

<script>
let echarts = require('echarts/lib/echarts')
require('echarts/lib/chart/bar')
require('echarts/lib/component/tooltip')
require('echarts/lib/component/title')
export default {
    name: 'Echarts',
    mounted () {
        this.drawLine();
    },
    data() {
        return {
            msg: ''
        }
    },
    methods: {
        // 基于准备好的dom，初始化echarts实例
        drawLine() {
        let myChart = echarts.init(document.getElementById('myChart'));
        // 绘制图表
        // console.log(myChart);
        myChart.setOption({
            title: {text: '在Vue中使用echarts'},
            tooltip: {},
            xAxis: {
            data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
            },
            yAxis: {},
            series: [{
                name: '销量',
                type: 'bar',
                data: [5, 20, 36, 10, 10, 20]
            }]
        })
        }
    }
}
</script>

<style>

</style>